//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;

namespace OpenLS.Spreadsheet.Internals
{
    abstract class RootGroup: Group
    {
        protected RootGroup(Worksheet worksheet)
        {
            _worksheet = worksheet;
        }

        private readonly Worksheet _worksheet;

        internal override bool Contains(Dimension dimension)
        {
            return true;
        }
        internal override bool Intersects(Dimension first, Dimension next)
        {
            return true;
        }
        internal override void Ungroup(Dimension first, Dimension next)
        {
            var children = new List<ChildGroup>(Children);
            foreach (var child in children)
            {
                if (child.Intersects(first, next))
                    child.Ungroup(first, next);
            }
        }
        public override bool IsDescendantOf(Group ancestor)
        {
            return false;
        }
        public override int Depth
        {
            get { return 0; }
        }
        internal override Group Root
        {
            get { return this; }
        }
        internal override Group Parent
        {
            get { return null; }
        }
        protected override void UngroupNoChild(Dimension first, Dimension next)
        {
            
        }
        internal override Worksheet Worksheet
        {
            get { return _worksheet; }
        }

    }
}